{% extends "services_base.html" %}
{% block head_content %}{% endblock head_content %}

{% block page_content %}

<div class="tag-content">
    <button id="setup_service" class="btn btn-primary">配置服务</button>
    <hr>
</div>

<div class="preview-content">
    {% for host in content %}
    <div class="service-entry">
        <div class="col-md-12 no-padding">
            <text>基本信息</text>
            <div class="fa fa-angle-down tab-line-icon" id="base_entry" style="float:right"></div>
        </div>
    </div>

    <div class="service-content" id="base_entry_content">
        <table class="table table-bordered">
            <tr>
                <td class="info col-md-4">HostName</td>
                <td>{{host.host_name}}</td>
            </tr>
            <tr>
                <td class="info col-md-4">IP</td>
                <td>{{host.ip}}</td>
            </tr>
            <tr>
                <td class="info">Port</td>
                <td>{{host.port}}</td>
            </tr>
            <tr>
                <td class="info">Server Enable LVM</td>
                <td>{{host.server_lvm}}</td>
            </tr>
        </table>
    </div>
    {% endfor %}

    {% for service_name, service_value in services.items %}
     <div class="service-entry">
         <div class="col-md-12 no-padding">
             <text>{{ service_name }}</text>
             <div class="fa fa-angle-down tab-line-icon" style="float:right" id="{{service_name}}"></div>
         </div>
     </div>
     <div class="service-content" id="{{service_name}}_content">
         <table class="table table-bordered">
             <tr>
                 <th class="col-md-3 no-padding">servername</th>
                 <th class="col-md-9 no-padding" >parameters</th>
             </tr>
             <!-- key2: host-name, value2: parameters -->
             {% for key2,value2 in service_value.items %}
             <tr class="info">
                 <td class="col-md-3 no-padding">{{ key2 }}</td>
                 <td class="col-md-9 no-padding">
                     <!-- key3: parameter.key, value3: parameter.value -->
                     {% if value2.items %}
                         {% for key3,value3 in value2.items %}
                         <div class="col-md-6 col-sm-6 col-xs-6 no-padding">{{ key3 }}:</div>
                         <div class="col-md-6 col-sm-6 col-xs-6 no-padding">
                             <input class="inputField" name="{{ key2 }}.{{ service_name }}.{{ key3 }}" type=text value="{{ value3 }}"></br>
                         </div>
                         {% endfor %}
                     {% else %}
                         <div class="col-md-6 col-sm-6 col-xs-6 no-padding">该服务不存在默认参数的定义</div>
                     {% endif %}
                 </td>
             </tr>
             {% endfor %}
         </table>
     </div>
    {% endfor %}


</div>
{% endblock page_content %}